<template>
	<view class="detail">
		<view class="title">
			{{detail.title}}
		</view>
		<view class="time">
			{{detail.add_time|formatTime}}
		</view>
		<view class="msgbox" v-html="getContent(detail.content)">

		</view>
	</view>
</template>

<script>
	import {
		NoticeDetail
	} from "@/api/api.js"
	export default {
		data() {
			return {
				detail: {}
			}
		},
		onLoad(e) {
			this.NoticeDetail(e.id)
		},
		methods: {
			NoticeDetail(id) {
				NoticeDetail({
					id
				}).then(res => {
					this.detail = res.data
				})
			},
			getContent(content) {
				if (typeof(content) == 'string')
					return content.replace(/<img src="/g, '<img style="max-width:100%" src="' + getApp().globalData.data
						.websiteUrl)
			}
		}
	}
</script>

<style lang="scss">
	.detail {
		padding: 10px;
		box-sizing: border-box;
		font-size: 14px;

		.msgbox {
			margin-top: 10px;
		}
	}

	.title {
		text-align: center;
		font-size: 16px;
		font-weight: bold;
	}

	.time {
		text-align: right;
		font-size: 14px;
		margin-top: 10px;
		color: #777;
	}
</style>
